const simpleServer = require('../simple-server')
const path = require('path')
const upload = require('express-fileupload')
const server = simpleServer(3000, path.join(__dirname, 'resources'))
server.use(
  upload({
    limits: { fileSize: 200 * 1024 * 1024 },
    useTempFiles: true,
    tempFileDir: path.join(__dirname, '/tmp/'),
    createParentPath: true,
  }),
)
server.post('/upload', (req, res) => {
  req.files.file.mv(path.join(__dirname, 'tmp', req.files.file.name))
  res.redirect('/success.html')
})
